import React, { Component } from 'react'
import { connect } from 'react-redux'
import * as actions from "../store/action.js"
import { bindActionCreators } from 'redux'
export class Binaji extends Component {
  render() {
    const {num,flag,dianAction} =this.props
    console.log(this.props)
    return (
      <div>
        <h1>{num}</h1>
        <button onClick={()=>{this.props.addNumAction()}}>加加</button>
        {flag ? '开灯' :'关灯'}
        <button onClick={()=>{dianAction()}}>开灯</button>

      </div>
    )
  }
}
const mapStateToProps= (state)=>({...state.reducer})
const mapDispatchToProps=(dispatch)=>{
  return bindActionCreators(actions,dispatch)
}

export default connect(mapDispatchToProps,mapStateToProps)(Binaji)
import React, { Component } from 'react'
import { connect } from 'react-redux'

// export class binaji extends Component {
//   render() {
//     return (
//       <div>binaji</div>
//     )
//   }
// }

// const mapStateToProps = (state) => ({})

// const mapDispatchToProps = {}

// export default connect(mapStateToProps, mapDispatchToProps)(binaji)